function HeadReader(is) {
	
	this.readHead = function() {
		return this.readHeadWFS(true);	
	}
	
	this.readHeadWFS = function(waitForStatus) {
		var stat = null, headers = new Array(), statusRead = !waitForStatus;

		var count = 0, inp;
		
		while((inp = is.readLine()) != null && (inp.length > 0 || !statusRead)) {
			if(inp.length > 0)
				if(startsWith(inp, ["GET", "POST", "HTTP", "OPTIONS"])) {
					stat = inp;
					statusRead = true;
				}
				else {
					var i = inp.indexOf(": ");
					if(i > -1) 
						headers[count++] = new Header(inp.substring(0, i), inp.substring(i+2, inp.length));
				}
		}
		
		return HeadFactory.createHead(stat, headers);

	}
	
	this.close = function() {}

	function startsWith(inp, strs) {
		for(var id in strs)
			if(inp.substring(0, strs[id].length) == strs[id])
				return true;
		return false;
	}
}